const postcss=require('postcss');
const plugin=(options)=>{
    const pxReg=/(\d+)px/ig;
    return {
        postcssPlugin:'postcss-simple-px2rem',
        Declaration(decl){
            decl.value=decl.value.replace(pxReg,(matchStr,num)=>{
                return num / options.base + 'rem';
            })
        }
    }
}

// 1rem=75px 

postcss([plugin({
    base:75
})]).process('a{font-size:20px;}').then(result=>{
    console.log(result.css)
})